
package tests;

import static org.junit.Assert.*;

import info.Conference;
import io.ConferenceAccess;
import java.util.List;
import org.junit.Before;
import org.junit.Test;

/**
 * This class is a JUNIT 4 test of the ConferenceAccess object.
 * 
 * @author Christopher M. Augg
 * @version March 20, 2014 
 * 
 */
public class ConferenceAccessTest { 

  /** A constant to test difference conferences by their conference ID. */
  private static final int CONF_ID = 0;
  
  /** ConferenceAccess object for connecting to Conference.xml. */
  private ConferenceAccess my_access;
    
  /**
   * Setting up the ConferenceAccess object before testing.
   * 
   * @throws java.lang.Exception The exception that can be thrown.
   */
  @Before
  public void setUp() throws Exception {
    my_access = new ConferenceAccess();   
   
  }

  /** 
   * Primary test to make sure object is instantiated.
   */
  @Test
  public void test() {
    assertNotNull(my_access);
  }
  
  /** Tests the getConference method. */
  @Test 
  public void getConference() {
    assertNotNull("No Conference!", my_access.getConference(CONF_ID));
  }
  
  /** Tests the getAllConferences method. */
  @Test
  public void getAllConferences() {
    final List<Conference> clist = my_access.getAllConferences();
    
    for (int i = 0; i < clist.size(); i++) {
      assertNotNull("No Conference here!", clist.get(i));
    }
    
  }
  
  

}
